<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.geoserver.community</groupId>
    <artifactId>gs-rest-openapi-generated</artifactId>
    <version>2.26-SNAPSHOT</version>
  </parent>
  <artifactId>gs-rest-openapi-generated-model</artifactId>
  <packaging>jar</packaging>
  <name>OpenAPI generated Catalog and Config object model</name>
  <properties>
    <openapi-base-folder>${project.parent.parent.basedir}/openapi/src/main/resources/org/geoserver/rest/openapi/1.0.0</openapi-base-folder>
  </properties>
  <dependencies>
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>javax.annotation-api</artifactId>
    </dependency>

    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.datatype</groupId>
      <artifactId>jackson-datatype-jsr310</artifactId>
    </dependency>

    <!-- @Nullable annotation -->
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.openapitools</groupId>
        <artifactId>openapi-generator-maven-plugin</artifactId>
        <version>${openapi-generator-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>generate-catalog-model</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <generatorName>java</generatorName>
              <inputSpec>${openapi-base-folder}/catalog.yaml</inputSpec>
              <configurationFile>${project.basedir}/catalog-model-config.json</configurationFile>
              <generateApis>false</generateApis>
              <generateSupportingFiles>true</generateSupportingFiles>
              <generateModelTests>false</generateModelTests>
              <generateApiTests>false</generateApiTests>
              <generateApiDocumentation>false</generateApiDocumentation>
              <generateModelDocumentation>false</generateModelDocumentation>
            </configuration>
          </execution>
          <execution>
            <id>generate-config-model</id>
            <goals>
              <goal>generate</goal>
            </goals>
            <configuration>
              <generatorName>java</generatorName>
              <inputSpec>${openapi-base-folder}/config.yaml</inputSpec>
              <configurationFile>${project.basedir}/config-model-config.json</configurationFile>
              <generateApis>false</generateApis>
              <generateSupportingFiles>false</generateSupportingFiles>
              <generateModelTests>false</generateModelTests>
              <generateApiTests>false</generateApiTests>
              <generateApiDocumentation>false</generateApiDocumentation>
              <generateModelDocumentation>false</generateModelDocumentation>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-source-generated</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/openapi/src</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
